<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8" />
<title>cisau信院免费邮--校园邮箱第一品牌</title>
<link rel="shortcut icon" href="<%=basePath %>images/favicon.ico" type="image/x-icon"/>
<meta name="description"
	content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="stylesheet" href="<%=basePath%>js/jPlayer/jplayer.flat.css"
	type="text/css" />
<link rel="stylesheet" href="<%=basePath%>css/bootstrap.css"
	type="text/css" />
<link rel="stylesheet" href="<%=basePath%>css/animate.css"
	type="text/css" />
<link rel="stylesheet" href="<%=basePath%>css/font-awesome.min.css"
	type="text/css" />
<link rel="stylesheet" href="<%=basePath%>css/simple-line-icons.css"
	type="text/css" />
<link rel="stylesheet" href="<%=basePath%>css/font.css" type="text/css" />
<link rel="stylesheet" href="<%=basePath%>css/app.css" type="text/css" />
</head>
<script type="text/javascript" src="<%=basePath %>js/jquery.min.js"></script>
<body>


	

	<!-- 头部开始 -->
	<header
		class="bg-white-only header header-md navbar navbar-fixed-top-xs">
	<div class="navbar-header aside bg-info nav-xs">
		<a class="btn btn-link visible-xs"
			data-toggle="class:nav-off-screen,open" data-target="#nav,html">
			<i class="icon-list"></i>
		</a> <a href="#" class="navbar-brand text-lt"> 
		<i class="fa fa-envelope-o" style="line-height: 62px;"></i>
		 <img src=""
			alt="看这里" class="hide"> <span class="hidden-nav-xs m-l-sm">@cisau.com</span>
		</a> <a class="btn btn-link visible-xs" data-toggle="dropdown"
			data-target=".user"> <i class="icon-settings"></i>
		</a>
	</div>
	<ul class="nav navbar-nav hidden-xs" style="height: 62px;">
		<li><a href="#nav,.navbar-header"
			data-toggle="class:nav-xs,nav-xs" class="text-muted"
			style="height: 62px;"> <i class="fa fa-indent text"></i> <i
				class="fa fa-dedent text-active"></i>
		</a></li>
	</ul>
	<div class="navbar-form navbar-left input-s-lg m-t m-l-n-xs hidden-xs"
		role="search">
		<div class="form-group">
			<div class="input-group">
				<span class="input-group-btn">
					<button type="button" class="btn btn-sm bg-white btn-icon rounded">
						<i class="fa fa-search"></i>
					</button>
				</span> <input type="text" id="everything" oninput="showAll();" class="form-control input-sm no-border rounded"
					placeholder="这里可以查询everything..." style="width: 300px;">
			</div>
		</div>
	</div>
	<div class="navbar-right ">
		<ul class="nav navbar-nav m-n hidden-xs nav-user user">

			<!-- 消息提醒部分start -->
			<li class="hidden-xs"><a href="#" class="dropdown-toggle lt"
				data-toggle="dropdown"> <i class="icon-bell"></i> <span
					class="badge badge-sm up bg-danger" id="unreadNum"></span>
			</a> <section class="dropdown-menu aside-xl animated fadeInUp">
				<section class="panel bg-white">
				<div class="panel-heading b-light bg-light">
					<strong>你有 <span id="unreadNum2"></span> 条邮件待查看
					</strong>
				</div>
				<div class="list-group-alt" id="unreadEmail"></div>
				<div class="panel-footer text-sm">
				
					<a href="<%=basePath %>jsp/allEmailList.jsp" class="pull-right"><i class="fa fa-chevron-circle-right"></i></a> 
					<a href="<%=basePath %>jsp/allEmailList.jsp" >查看详情</a>
				</div>
				</section> </section></li>
			<!-- 消息提醒部分end -->
			<!-- 用户中心start -->
			<li class="dropdown"><a href="#"
				class="dropdown-toggle bg clear" data-toggle="dropdown"> <span
					class="thumb-sm avatar pull-right m-t-n-sm m-b-n-sm m-l-sm">
					<c:if test="${USER.picpath!=null&&USER.picpath!='' }">
						<img src="<%=basePath %>${USER.picpath }" alt="...">
					</c:if>
					<c:if test="${USER.picpath==''||USER.picpath==null }">
						<img src="../images/noT.jpg" alt="...">
					</c:if>
						
				</span> ${USER.realname } <b class="caret"></b>
			</a>
				<ul class="dropdown-menu animated fadeInRight">
					<li><span class="arrow top"></span> <a href="<%=basePath %>jsp/editPerson.jsp"><i class="icon-settings"></i>&nbsp;&nbsp;设置</a></li>
					<!-- <li><a href="profile.html">Profile</a></li>
					<li><a href="#"> <span class="badge bg-danger pull-right">3</span>
							Notifications
					</a></li>
					<li><a href="docs.html">Help</a></li>
					<li class="divider"></li> -->
					<li><a href="<%=basePath %>puser/logout" data-toggle="ajaxModal"> <i class="icon-logout"></i>&nbsp;&nbsp;退出登录</a>
					</li>
				</ul></li>
			<!-- 用户中心end-->
		</ul>
	</div>
	</header>
	<!-- 头部结束 -->



	<!--身体部分start -->
	<section style="min-height:855px;"> <section
		class="hbox stretch" style="min-height:855px;"> <!-- ·左侧导航栏开始 -->
	<aside class="bg-black dk nav-xs aside hidden-print" id="nav">
	<section class="vbox"> <section class="w-f-md scrollable">
	<div class="slim-scroll" data-height="auto"
		data-disable-fade-out="true" data-distance="0" data-size="10px"
		data-railOpacity="0.2">



		<!-- nav -->
		<nav class="nav-primary hidden-xs">

		<ul class="nav bg clearfix">
			<li class="hidden-nav-xs padder m-t m-b-sm text-xs text-muted">
				我的邮箱</li>

			<!-- 左侧列表 -->
			<li><a href="<%=basePath%>jsp/index.jsp"> <i
					class="icon-disc icon text-success"></i> <span class="font-bold">首页</span>
			</a></li>
			<li><a href="<%=basePath%>jsp/allEmailList.jsp"> <i
					class="icon-envelope-open icon text-info"></i> <span
					class="font-bold">收件箱（<font id="unreadNum3"></font>）</span>
			</a></li>


			<li><a href="<%=basePath%>jsp/sendEmail.jsp"> <i
					class="icon-note icon icon text-primary-lter"></i> <span
					class="font-bold">写信</span>
			</a></li>
			<li><a href="<%=basePath%>jsp/sendInform.jsp"> 
					<i class="icon-note icon icon icon-volume-1"></i> <span
					class="font-bold">发送通知</span>
			</a></li>



			<li><a href="index.html"> <i class="icon-cup"></i> <span
					class="font-bold">待办邮件</span>
			</a></li>


			<li><a href="<%=basePath%>jsp/asteriskEmailList.jsp"> <i class="icon-star"></i> <span
					class="font-bold">星标邮件</span>
			</a></li>

			<li><a href="<%=basePath%>jsp/draftList.jsp"> <i class="fa fa-paste"></i> <span
					class="font-bold">草稿箱</span>
			</a></li>
			<li><a href="<%=basePath %>jsp/mySentEmail.jsp"> <i class="fa fa-foursquare"></i> <span
					class="font-bold">已发送</span>
			</a></li>


		</ul>





		<ul class="nav" data-ride="collapse">
			<li class="hidden-nav-xs padder m-t m-b-sm text-xs text-muted">
				Interface</li>

			<li><a href="#" class="auto"> <span
					class="pull-right text-muted"> <i
						class="fa fa-angle-left text"></i> <i
						class="fa fa-angle-down text-active"></i>
				</span> <i class="icon-screen-desktop icon"> </i> <span>其他邮件</span>
			</a>
				<ul class="nav dk text-sm">
					<li><a href="<%=basePath %>jsp/myDelEmail.jsp" class="auto"> <i
							class="fa fa-angle-right text-xs"></i> <i
							class="fa fa-times-circle-o"></i> <span>已删除</span>
					</a></li>
					<li><a href="<%=basePath %>jsp/dustbin.jsp" class="auto"> <i
							class="fa fa-angle-right text-xs"></i> <i class="icon-trash"></i>
							<span>垃圾邮件</span>
					</a></li>
					
				</ul></li>



			<li><a href="#" class="auto"> <span
					class="pull-right text-muted"> <i
						class="fa fa-angle-left text"></i> <i
						class="fa fa-angle-down text-active"></i>
				</span> <i class="icon-users icon"></i> <span>通讯录</span>
			</a>
				<ul class="nav dk text-sm">
					
					<li><a href="<%=basePath %>jsp/addFriend.jsp" class="auto"> <i
							class="fa fa-angle-right text-xs"></i> <span>好友管理</span>
					</a></li>
					<li><a href="<%=basePath %>jsp/blackList.jsp" class="auto"> <i
							class="fa fa-angle-right text-xs"></i> <span>黑名单</span>
					</a></li>



				</ul></li>
		</ul>


		</nav>
		<!-- / nav -->
	</div>
	</section> </section> </aside> <!-- 左侧导航栏结束 --> <!-- Bootstrap --> <script
		src="<%=basePath%>js/bootstrap.js"></script> <!-- App --> <script
		src="<%=basePath%>js/app.js"></script> <script
		src="<%=basePath%>js/slimscroll/jquery.slimscroll.min.js"></script> <script
		src="<%=basePath%>js/app.plugin.js"></script> <script
		type="text/javascript"
		src="<%=basePath%>js/jPlayer/jquery.jplayer.min.js"></script> <script
		type="text/javascript"
		src="<%=basePath%>js/jPlayer/add-on/jplayer.playlist.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/jPlayer/demo.js"></script>
</body>
<script>
$(document).ready(function(){
	
	unreadNum();
	unreadEmail();
	var time = window.setInterval('unreadNum()',30000);
	var time = window.setInterval('unreadEmail()',30000);
});
	function unreadNum(){
		var unreadNum = document.getElementById("unreadNum");
		unreadNum.innerHTML='';
		var unreadNum2 = document.getElementById("unreadNum2");
		unreadNum2.innerHTML='';
		var unreadNum3 = document.getElementById("unreadNum3");
		unreadNum3.innerHTML='';
		$.ajax( {
						url:'<%=basePath%>email/unreadNum',
						type:'post',
						data: {
							
						},
						datatype : "text",//"xml", "html", "script", "json", "jsonp", "text".           
						success : function(data) {
							var val = data;
							if(data!=0){
								$("#unreadNum").append(val);
							}
							
							$("#unreadNum2").append(val);
							$("#unreadNum3").append(val);
							
						},
						error : function() {
			                alert("未读邮件数量异常！！！");
			                
			            }
				});
	}
	
	function unreadEmail(){	
		var unreadEmail = document.getElementById("unreadEmail");
		unreadEmail.innerHTML='';
		$.ajax( {
			url:'<%=basePath%>email/unreadEmail',
			type:'post',
			data: {
				
			},
			datatype : "json",//"xml", "html", "script", "json", "jsonp", "text".           
			success : function(data) {
				
				var json=eval('(' + data + ')');
				$.each(json, function (n, item) {
					
					addNoRead(n,item);
				});
			},
			 error : function() {
                 alert("添加异常！");
                 
             }
		});
	}
	
	
function addNoRead(n,item){
		
	var val = "<a href=\"../email/selEmailDetail?id="+item.id+"\" class=\"media list-group-item\">"+
    "<span class=\"pull-left thumb-sm\">";

    if(""===item.sendManPicpath){
    	val = val+"<i class=\"fa fa-comments\" style=\"font-size:20px;\"></i>";
    }else{
    	val = val+"<img src=\"../"+item.sendManPicpath+"\" alt=\"发件人头像\" class=\"img-circle\">";
    }
      val = val+"</span>"+
    "<span class=\"media-body block m-b-none\">"+
     item.title+"<br>"+
      "<small class=\"text-muted\">"+item.createTime+"</small>"+
    "</span>"+
  "</a>";
			
		$("#unreadEmail").append(val);
	}
	

</script>
</html>